<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Collection"%>
<%@page import="orm.Items"%>
<%@page import="hibernatelogic.HibItems"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%
	HttpSession sess = request.getSession();
	if (sess.isNew()) {
		response.sendRedirect("/my-pet-project-0/Login.jsp");
	} else {
%>
<%
	if (((String) sess.getAttribute("UserRole")).equals("2")) {
%>
<%
			HibItems hibItems = new HibItems();
			Items item = new Items();
			Collection col = null;
			Iterator it = null;
			col = hibItems.getAllItems();
			ArrayList tmpCol = (ArrayList) col;
			it = tmpCol.iterator();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Delete Items</title>
</head>
<body>
	<a href="/my-pet-project-0/Login.jsp">Logout</a>
	<a href="/my-pet-project-0/ManagerStartPage.jsp">Back</a>
	<br>
	<br>
	<center>
		Which item do you want to delete? <br> <br>
		
		<form action="delete-item-servlet" method="post">
			<select name="ditem">
				<%
					while (it.hasNext()) {
				%>
				<%
					item = (Items) it.next();
				%>
				<option value=<%=item.getItem_id()%>><%=item.getItem_name()%>
					<%
						}
					%>
				
			</select> <input type="submit" value="Delete Item">
		</form>
		
	</center>
</body>
</html>
<%
	} else {
%>
<%
	response.sendError(response.SC_FORBIDDEN,
					"Not permitted to enter as MANAGER");
%>
<%
	}
	}
%>